﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using DAL;
using System.Data.SqlClient;
namespace BLL
{
   public class RepairsBll
    {
       RepairsDal dal = new RepairsDal();

       /// <summary>
       /// 添加
       /// </summary>
       /// <param name="t">实体对象</param>
       /// <returns>bool类型 true为添加成功，false为添加失败</returns>
       public bool Add(Repairs r)
       {
           return dal.Add(r);
       }

          /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
       public Repairs Back(int id)
       {
           return dal.Back(id);
       }
       /// <summary>
        /// 显示
        /// </summary>
        /// <param name="name"></param>
        /// <param name="date"></param>
        /// <param name="state"></param>
        /// <returns></returns>
       public List<Repairs> show(string name, string date, string state, string LogName,int PageIndex,int PageSize,out int PageCount)
       {
           PageCount = dal.show(name, date, state, LogName).Count();
           return dal.show(name, date, state, LogName).Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
       }

       /// <summary>
        /// 修改评价
        /// </summary>
        /// <returns></returns>
       public int updping(float star, string comments, int id)
       {
           return dal.updping(star, comments, id);
       }
       public List<Repairs> ShowPair(params SqlParameter[] paramters)
       {
           return dal.Show(paramters);
       }
       /// <summary>
       /// 审批
       /// </summary>
       /// <param name="PageIndex"></param>
       /// <param name="PageSize"></param>
       /// <param name="PageCount"></param>
       /// <param name="paramters"></param>
       /// <returns></returns>
       public List<Repairs> ShowPair(int PageIndex, int PageSize, out int PageCount, params SqlParameter[] paramters)
       {
           PageCount = dal.Show(paramters).Count();
           return dal.Show(paramters).Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
       }
       public Repairs BackPairs(int id)
       {
           return dal.Back(id);
       }
       public bool UpdPairs(Repairs t, int id)
       {
           return dal.Update(t,id);
       }
    }
}
